#include<stdio.h>

int main()
{
    int x = 0;
    scanf("%d", &x);
    long long s = 0;
    long long num = 0;
    while (1)
    {
        num = num * 10 + 1;
        if (num / x != 0 && num % x == 0)
        {
            s = num / x;
            break;
        }
    }
    printf("%lld ", s);
    int count = 0;
    while (num)
    {
        count++;
        num /= 10;
    }
    printf("%d", count);
    return 0;
}